package com.be.beadmin.system.controller;


import com.be.beadmin.basicData.entity.User;
import com.be.beadmin.basicData.repository.UserRepository;
import com.be.beadmin.common.utils.ResultModel;
import com.be.beadmin.logging.impl.TestHello;
import com.be.beadmin.remote.SystemService;
import com.be.beadmin.system.service.ReportFormsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
@Api(tags = {"电子看板"})
@RestController
public class HelloController {

    @Autowired
    private TestHello testHello;

    @Autowired
    UserRepository userRepository;


    @Autowired
    SystemService systemService;
//    @Autowired
//    TestRepository testRepository;

    @RequestMapping("/hello")
    public ResultModel helloWorld(){
        List<User> userList = userRepository.findAll();
        return  ResultModel.success(userList);
    }


    @RequestMapping("/helloTest")
    public String helloTest(){
//        Test2 test2 = new Test2();
//        test2.setUsername("chenwei");
//        testRepository.save(test2);
        return testHello.sayHello();
    }


    @PostMapping("/helloTest2")
    public String helloTest2(@RequestBody String name){
//        Test2 test2 = new Test2();
//        test2.setUsername("chenwei");
//        testRepository.save(test2);
        return systemService.getSystemHello(name);
    }

//    @RequestMapping("/hello2")
//    public String helloWorld2(){
//        return "";
//    }
@Autowired
private ReportFormsService reportFormsService;
    @ApiOperation("异常表")
    @PostMapping(value = "/welcome/getErrorReportByPage")
    public ResultModel getReportformsErrorReportByPage()  {
        return ResultModel.success(reportFormsService.getReportformsErrorReportByPage()) ;
    }
    //生产交货能力
    @Autowired
    private ReportFormsService workOrderInforService;
    @ApiOperation("生产交货能力")
    @PostMapping(value = "/welcome/getReportformsWorkOrderInforByPage")
    public ResultModel getReportformsWorkOrderInforByPage()  {
        return ResultModel.success(workOrderInforService.getReportformsWorkOrderInforObjectByPage()) ;
    }
    @Autowired
    private ReportFormsService plantCapacityCalendarService;
    //生产力
    @ApiOperation("生产力")
    @PostMapping(value = "/welcome/getReportformsPlantCapacityCalendarByPage")
    public ResultModel getReportformsPlantCapacityCalendarByPage()  {
        return ResultModel.success(plantCapacityCalendarService.getReportformsPlantCapacityCalendarByPage()) ;
    }

    //生产率
    @ApiOperation("生产率")
    @PostMapping(value = "/welcome/getReportformsPlantCapacityCalendarByPage2")
    public ResultModel getReportformsPlantCapacityCalendarByPage2()  {
        return ResultModel.success(plantCapacityCalendarService.getReportformsPlantCapacityCalendarByPage2()) ;
    }
    //物料齐套率
    @ApiOperation("物料齐套率")
    @PostMapping(value = "/welcome/getReportformsPickingTaskByPage")
    public ResultModel getReportformsPickingDetailsByPage()  {
        return ResultModel.success(plantCapacityCalendarService.getReportformsPickingTaskByPage()) ;
    }
    //生产计划达成率
    @ApiOperation("生产计划达成率")
    @PostMapping(value = "/welcome/getReportformsProductManufactInforExecuteByPage")
    public ResultModel getReportformsProductManufactInforExecuteByPage() {
        return ResultModel.success(plantCapacityCalendarService.getReportformsProductManufactInforExecuteByPage());
    }

    //线路故障率
    @ApiOperation("线路故障率")
    @PostMapping(value = "/welcome/getReportformsCabinetQuality")
    public ResultModel getReportformsCabinetQuality() {
        return ResultModel.success(plantCapacityCalendarService.getReportformsCabinetQuality());
    }

    //客户投诉缺陷数
    @ApiOperation("客户投诉缺陷数")
    @PostMapping(value = "/welcome/getReportformsCustomComplaint")
    public ResultModel getReportformsCustomComplaint() {
        return ResultModel.success(plantCapacityCalendarService.getReportformsCustomComplaint());
    }
    //生产文件齐套率
    @ApiOperation("生产文件齐套率")
    @PostMapping(value = "/welcome/getReportformsWorkOrderInforByPage2")
    public ResultModel getReportformsWorkOrderInforByPage2() {
        return ResultModel.success(plantCapacityCalendarService.getReportformsWorkOrderInforByPage2());
    }

    //客户投诉数
    @ApiOperation("客户投诉数")
    @PostMapping(value = "/welcome/getReportformsCustomComplaint2")
    public ResultModel getReportformsCustomComplaint2() {
        return ResultModel.success(plantCapacityCalendarService.getReportformsCustomComplaint2());
    }
}



